Utility and reporting contracts =============================== Small operations preserve the same axes and units as their larger callers. The runnable companion is ``WorkingWithAModel/utility_contracts/howto.m``. Arrays and structures --------------------- ``utils.parallel.divvy_up_parameters`` partitions columns of a parameter-by-draw matrix. Concatenating its partitions reconstructs every draw exactly once. ``nested_for_loops`` addresses the supplied index values even when reordered. ``renamefields`` renames simultaneously, so swaps preserve values; collisions with untouched fields are rejected. ``max_discrepancy`` requires identical field sets and nested dimensions: missing data cannot report zero discrepancy. ``locate_variables`` accepts character, cell and string names, with the existing logical-selection and silent-missing options. ``rise_inequal`` uses absolute tolerance ``sqrt(eps)``. Strict less/greater means a difference below minus tolerance/above tolerance. Equality includes both boundaries; inclusive comparisons include that same tolerance band. ``utils.test.fails`` requires the callback itself to throw, then checks its message. A successful callback cannot satisfy an expected-failure test. ``E_kron_X_Y`` uses column-major vectorization: X is n-by-p, Y is n-by-q, and ``Oyx`` is n*q-by-n*p, the covariance of vec(Y) with vec(X). Generated switching matrix problems have nonnegative transition rows summing to one and retain their constructed matrix residuals, including three or more regimes. These residual checks make no claim about equilibrium uniqueness. Covariance regularization ------------------------- ``rise.engine.numerics.cov.project(S)`` now uses coordinate scale when both bounds are empty. After symmetrizing S, it sets each coordinate scale to ``sqrt(S_ii)`` when the diagonal is positive. Other coordinates use the square root of the largest diagonal. Eigenvalues of ``D\S/D`` are clipped to ``[sqrt(eps),1/sqrt(eps)]``, then the matrix is rescaled by D on both sides. Healthy symmetric inputs are returned bit for bit, with ``is_altered=false``. Symmetrization or clipping reports ``true``. For nonzero S with no positive diagonal the standardization is undefined, so the former absolute default is retained: ``[sqrt(eps),1/sqrt(eps)]``. Zero continues to return ``sqrt(eps)*I``. Supplying either bound explicitly selects the absolute branch; an empty lower bound becomes ``sqrt(eps)`` and an empty upper bound becomes the reciprocal of the resulting lower bound. ``utils.mcmc.update_moments`` passes an omitted or empty ``e`` to this new default. Explicit positive ``e`` keeps absolute bounds. The separate ``nearest`` function, including its ``farthest`` mode, retains its absolute floor ``sqrt(eps)``. The runnable companion is ``WorkingWithAModel/covariance_scale_example.m``. Text, reports and charts ------------------------ Argument parsing splits only top-level commas outside (), [] and {} and quoted literals. Nested calls, array commas and transpose apostrophes retain their text. Chart expression lookup likewise ignores names inside literals while retaining variables next to transpose operators. A raw report block can be ``x=1`` or span multiple lines. Text after the closing tag returns to prose; a missing closing tag is an error. Display labels may follow the opening, closing or same-line display delimiter:: $$ x=1 $$ {#eq:one} Conflicting labels are rejected. Code listings and noexec blocks retain the actual source line after leading blanks are removed. An empty requested chart range means all available data. A nonempty range disjoint from the data instead reports an unavailable chart, or raises the normal chart error when ``OnError="stop"``. It never silently draws the full series. Plot callbacks return graphics handles, including arrays; each handle inherits applicable styling and the label of its originating variant. Numerical helpers and runtime boundaries ---------------------------------------- ``smax(x,y,smooth)`` implements the algebraic expression ``(x+y)/2+sqrt(((x-y)/2)^2+smooth)`` elementwise. The default is 1e-10; smoothing is a finite nonnegative scalar. Smaller smoothing approaches max, and the gap at a tie is sqrt(smooth). Scaled arithmetic and a rationalized correction avoid intermediate overflow/cancellation for finite floating-point inputs while preserving local complex-step derivatives. The formula and its approximation are unchanged. MCMC inverse coordinate maps apply to every draw and the selected best point; its log posterior is unchanged. Autocorrelation bars use actual positive lags, including the requested endpoint. Worker setup waits for path propagation, then startup, and surfaces either error before announcing success. Memory budgets use Windows array limits, macOS free pages with reported page size, or Linux MemAvailable/MemFree in kB. Unknown information yields zero bytes. Batch conversion snapshots the current folder tree once and preserves complete filenames. Results go to each folder's rise_version directory. skip_done=true skips existing output folders; failures name absolute input paths. The working folder is restored even after a failure. UDC refinement uses the validated TolFun and maxiter options. Evidence and portable files --------------------------- Steady-state diagnosis checks all residuals before selecting a regime, exposing ``regime_finite`` and ``regime_max_resid``. Structural evidence carries status ok, deficient, unavailable or not_run. An unavailable check has empty ``ok`` and retains its exception; a completed cell-based incidence check reports each game. These are incidence and residual diagnostics, not equilibrium certificates. Recognized failures of requested moments, responses, decompositions or filtering leave dependent model conditions unavailable. Independently evaluable conditions may still work. A malformed expression at a successful point remains an error. Portable JSON and reconstructed source explicitly use UTF-8 bytes. Existing model-reader character-set handling is retained. Reconstructed descriptions use the normal model description marker. Chain names cannot contain an underscore: valid prefix names such as s and smore have distinct ``s_`` and ``smore_`` state prefixes.